/**
 * Created by yu on 16/8/23.
 * 获取请求中的数据
 */
var http = require('http');
var server = http.createServer(function(request,response){
    console.log(request.method);
    console.log(request.url);
    console.log(request.headers);

    response.statusCode = 404;
    //响应头和响应体的顺序不能调换,必须先响应头,在写响应体
    response.setHeader('Content-Type','text/html;charset=utf-8');
    response.write('hello');
    setTimeout(function(){
        response.write('world');
        response.end('over');
    },2000);

});
server.listen('8082','127.0.0.1');
